import companyInfo
import companyNotice
import os
import config
import hangye
import workQueue




def start(hangyeming):
    code = hangye.getKeyByName(hangyeming)
    info = companyInfo.requestInfo(code,'广西省')
    if len(info)>0:
        path = os.path.join(config.basePath,info[0]['xxhyzl'])
        if not os.path.exists(path):
             os.mkdir(path)
    for company in info:
        companyNotice.getNoticeInfo(company['xxzqdm'],0)
        




#入口
if __name__ == '__main__':
    config.basePath = os.path.join(os.path.abspath('.'),'download_file')
    if(not os.path.exists(config.basePath)):
        os.mkdir(config.basePath)
    start('计算机、通信和其他电子设备制造业')
    start('互联网和相关服务')
    start('软件和信息技术服务业')
    workQueue.startToWork()
    workQueue.wait()
    workQueue.exitWork()
